package be.ipl.diavoloJSP.servlets;

import java.io.IOException;
import java.util.List;

import javax.ejb.EJB;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import be.ipl.diapero.domaine.Partie;
import be.ipl.diapero.ucc.GestionPartie;

@WebServlet(name = "consulterJournaux.html")
public class ConsulterJournaux extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@EJB
	GestionPartie gestionPartie;

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		
		List<Partie> parties = gestionPartie.listerPartiesTerminees();
		request.setAttribute("parties", parties);
		RequestDispatcher rd = getServletContext().getNamedDispatcher(
				"listeJournaux.html");
		rd.forward(request, response);
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
